Skip to content

Conversation

@IlyasRidhuan
Copy link
Contributor

@IlyasRidhuan IlyasRidhuan commented Jan 6, 2026

Mutations for gas-related fields in the tx (including gasUsedByPrivate, and Feepayer)

Copy link
Contributor Author

IlyasRidhuan commented Jan 6, 2026

@IlyasRidhuan IlyasRidhuan force-pushed the ir/01-05-feat_avm_gas_mutations branch from 7b56b51 to 93eb5a8 Compare January 7, 2026 10:35
@IlyasRidhuan IlyasRidhuan force-pushed the ir/01-04-feat_avm_mutations_for_accumulated_data branch from e8578e9 to ae09b1d Compare January 7, 2026 10:35
@IlyasRidhuan IlyasRidhuan force-pushed the ir/01-05-feat_avm_gas_mutations branch from 93eb5a8 to aa96990 Compare January 7, 2026 10:43
@IlyasRidhuan IlyasRidhuan force-pushed the ir/01-04-feat_avm_mutations_for_accumulated_data branch 2 times, most recently from 3c26110 to d291430 Compare January 7, 2026 10:56
@IlyasRidhuan IlyasRidhuan force-pushed the ir/01-05-feat_avm_gas_mutations branch from aa96990 to 3700f20 Compare January 7, 2026 10:56
@IlyasRidhuan IlyasRidhuan force-pushed the ir/01-04-feat_avm_mutations_for_accumulated_data branch from d291430 to c282ab6 Compare January 7, 2026 15:49
@IlyasRidhuan IlyasRidhuan force-pushed the ir/01-05-feat_avm_gas_mutations branch 2 times, most recently from 3d86939 to d39d11f Compare January 8, 2026 12:48
@IlyasRidhuan IlyasRidhuan force-pushed the ir/01-04-feat_avm_mutations_for_accumulated_data branch from c282ab6 to 40f1713 Compare January 8, 2026 12:48
@IlyasRidhuan IlyasRidhuan force-pushed the ir/01-04-feat_avm_mutations_for_accumulated_data branch from 40f1713 to fd2d950 Compare January 8, 2026 13:04
@IlyasRidhuan IlyasRidhuan force-pushed the ir/01-05-feat_avm_gas_mutations branch 2 times, most recently from 4168739 to 6f984cd Compare January 8, 2026 13:11
@IlyasRidhuan IlyasRidhuan force-pushed the ir/01-04-feat_avm_mutations_for_accumulated_data branch from fd2d950 to 5420487 Compare January 8, 2026 13:11
@IlyasRidhuan IlyasRidhuan changed the base branch from ir/01-04-feat_avm_mutations_for_accumulated_data to graphite-base/19348 January 8, 2026 15:17
@IlyasRidhuan IlyasRidhuan force-pushed the ir/01-05-feat_avm_gas_mutations branch from 6f984cd to fbabbed Compare January 8, 2026 15:49
@IlyasRidhuan IlyasRidhuan changed the base branch from graphite-base/19348 to ir/01-04-feat_avm_mutations_for_accumulated_data January 8, 2026 15:49
@IlyasRidhuan IlyasRidhuan changed the base branch from ir/01-04-feat_avm_mutations_for_accumulated_data to graphite-base/19348 January 9, 2026 13:03
@IlyasRidhuan IlyasRidhuan force-pushed the ir/01-05-feat_avm_gas_mutations branch from fbabbed to ac33049 Compare January 9, 2026 13:38
//
// Gas bounds for mutation
constexpr uint32_t MIN_GAS = 0;
constexpr uint32_t AVM_MAX_PROCESSABLE_DA_GAS = (MAX_NOTE_HASHES_PER_TX * AVM_EMITNOTEHASH_BASE_DA_GAS) +
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might not be 100% right, but probably ballpark? @sirasistant

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah should be close enough

case TxMutationOptions::GasUsedByPrivate:
// Mutate gas_used_by_private
fuzz_info("Mutating gas used by private");
mutate_gas(tx.gas_used_by_private, rng);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do i need to check that this value is < gas_limits ? Or is it worthwhile trying out scenarios where this is not true?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As an improvement, we might want to generate taking into account the limit instead of generate + clamp, or we we'll overrepresent gas used by private == limit

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or we could just generate it and then do modulo the limit

@IlyasRidhuan IlyasRidhuan marked this pull request as ready for review January 9, 2026 13:47
@IlyasRidhuan IlyasRidhuan force-pushed the ir/01-05-feat_avm_gas_mutations branch from ac33049 to 193d8a7 Compare January 9, 2026 14:39
@IlyasRidhuan IlyasRidhuan changed the base branch from graphite-base/19348 to merge-train/avm January 9, 2026 14:39
@IlyasRidhuan IlyasRidhuan force-pushed the ir/01-05-feat_avm_gas_mutations branch from 193d8a7 to 3faa9e2 Compare January 9, 2026 14:52
Copy link
Contributor

@sirasistant sirasistant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! just a note on clamping vs the limit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants